﻿using JunYu.CodeGeneration;
using JunYu.CodeGeneration.Models.Model;
using JunYu.CodeGeneration.Repositorys;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            /*DbContextOptionsBuilder<CGDbContext> options = new DbContextOptionsBuilder<CGDbContext>();
            options.UseSqlServer(@"Data Source=192.168.3.6;Initial Catalog=CodeGenerationDb;User ID=sa;Password=123456");
            var d = options.Options;
            CGDbContext context = new CGDbContext(d);
            ICodeGenRepositorys<c> repositorys = new CodeGenRepositorys<DBConnectionInfo>(context);
            DBConnectionInfo data = new DBConnectionInfo()
            {
                Id = Guid.NewGuid(),
                CreateMan = "卢俊雨",
                Remark = "备注控制太连接",
                DbType = 0,
                ConnecttiomName = "sqlservertest",
                Host = "127.0.0.1",
                Post = "3306",
                DbName = "Student",
                UserName = "sa",
                PassWord = "123456"
            };
            repositorys.Add(data);
            Console.WriteLine("添加成功");*/


            /*IServiceCollection services = new ServiceCollection();
            services.AddDbContext<CGDbContext>(options => 
            options.UseSqlServer(@"Data Source=192.168.3.6;Initial Catalog=CodeGenerationDb;User ID=sa;Password=123456"));
            services.AddScoped(typeof(ICodeGenRepositorys<>), typeof(CodeGenRepositorys<>));
            var provider = services.BuildServiceProvider();
            var f = provider.GetRequiredService<ICodeGenRepositorys<DBConnectionInfo>>();
            DBConnectionInfo data = new DBConnectionInfo()
            {
                Id = Guid.NewGuid(),
                CreateMan = "卢俊雨",
                Remark = "备注控制太连接",
                DbType = 0,
                ConnecttiomName = "sqlservertest",
                Host = "127.0.0.1",
                Post = "3306",
                DbName = "Student",
                UserName = "sa",
                PassWord = "123456"
            };
            f.Add(data);*/

            object i = 11;
            var a = i as int?;
            var x = a + 11;
            Console.WriteLine(x);
        }
    }
}
